﻿using NPOI.OpenXmlFormats.Dml.Diagram;
using System.Windows.Input;

namespace YunxSoft.AfterSchoolClazz.Models
{
    public class StudentSchedule
    {
        /// <summary>
        /// 序号
        /// </summary>
        public int Id { get; set; }                

        /// <summary>
        /// 班级
        /// </summary>
        public string Class { get; set; }          

        /// <summary>
        /// 学生姓名
        /// </summary>
        public string StudentName { get; set; }    // 对应“学生姓名”
        
        /// <summary>
        /// 课程
        /// </summary>
        public Dictionary<string, string> Courses { get; set; }

        public bool MatchesCourse(Schedule schedule)
        {
            if (!Courses.TryGetValue(schedule.Date, out var sc))
            {
                return false;
            }

            if (!schedule.Grade.Contains(Class.Substring(0, 1)))
            {
                return false;
            }

            if (schedule.CourseFormat != CourseFormat(sc))
            {
                return false;
            }

            return true;
        }

        public static string CourseFormat(string courseName)
        {
            return courseName.Replace("【基本活动】", "").Replace("【基础活动】", "").Replace("【特色活动】", "").Replace("（", "").Replace("）", "");
        }

    }
}
